﻿<%@ Page Title="Funcionário" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    ValidateRequest="false" CodeBehind="Funcionario.aspx.cs" Inherits="Follow.Cadastros.Funcionario" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <div class="Titulo">
        <%: Title %><br />
        <asp:Image ID="imgTitulo" runat="server" ImageUrl="~/images/linhas_17.png" />
    </div>
    <asp:Label ID="lblMsg" runat="server" CssClass="lblMsg" Visible="false"/><br />
    <asp:MultiView ID="mvFuncionarios" runat="server" ActiveViewIndex="0">
        <asp:View ID="View1" runat="server">
            <div class="subTitulo">
                <asp:Label ID="lblTituloView1" runat="server" Text="Lista de Funcionários" />
            </div>           
            <div id="divMsg1" class="isa_info" runat="server" visible="false" >
                <asp:Label ID="lblMsg1" runat="server" Text="Mensagem." />
            </div>
            <div class="divPesquisa">
                <asp:Label ID="lblPesquisa" Text="Pesquisa:" runat="server" /><br />
                <asp:TextBox ID="txtPesquisa" runat="server" Width="300px" Height="25px" />
                <asp:Button ID="btnPesquisa" runat="server" Text="Pesquisar" OnClick="btnPesquisa_Click"
                    CssClass="Botao" />
                <asp:Button ID="btnIncluir" runat="server" Text="Incluir" OnClick="btnIncluir_Click"
                    CssClass="Botao" /><br />
                <asp:CheckBox ID="ckbPesquisa" runat="server" Text="Mostrar inativos" 
                    oncheckedchanged="ckbPesquisa_CheckedChanged" CssClass="checkBox"/>
            </div>
            <br />
            <br />
            <asp:GridView ID="gvFuncionarios" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                DataKeyNames="IDFuncionario" Width="765px" BackColor="White" BorderColor="#DEDFDE"
                BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Vertical"
                OnRowCommand="gvFuncionarios_RowCommand" OnSelectedIndexChanged="gvFuncionarios_SelectedIndexChanged" OnPageIndexChanging="gvFuncionarios_PageIndexChanging">
                <AlternatingRowStyle BackColor="White" />
                <Columns>
                    <asp:BoundField HeaderText="Funcionario" DataField="Nome" />
                    <asp:BoundField HeaderText="CPF" DataField="Cpf" ItemStyle-HorizontalAlign="Center" />
                    <asp:CheckBoxField HeaderText="Gerente" DataField="TipoFunc" ReadOnly="True" ItemStyle-HorizontalAlign="Center" />
                    <asp:CheckBoxField HeaderText="Ativo" DataField="Ativo" ReadOnly="True" ItemStyle-HorizontalAlign="Center" />
                    <asp:ButtonField ButtonType="image" ImageUrl="~/Images/editar.png" CommandName="Editar"
                        HeaderText="Editar" ItemStyle-HorizontalAlign="Center" />
                    <asp:ButtonField ButtonType="image" ImageUrl="~/Images/excluir.png" CommandName="Excluir"
                        HeaderText="Excluir" ItemStyle-HorizontalAlign="Center" />
                     <asp:ButtonField ButtonType="image" ImageUrl="~/Images/AssociarMetas.png" CommandName="Associar"
                        HeaderText="Associar Metas" ItemStyle-HorizontalAlign="Center" />
                </Columns>
                <FooterStyle BackColor="#CCCC99" />
                <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
                <RowStyle BackColor="#F7F7DE" />
                <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
                <SortedAscendingCellStyle BackColor="#FBFBF2" />
                <SortedAscendingHeaderStyle BackColor="#848384" />
                <SortedDescendingCellStyle BackColor="#EAEAD3" />
                <SortedDescendingHeaderStyle BackColor="#575357" />
            </asp:GridView>
            <asp:Label ID="lblMsgGridFuncionarios" runat="server" Text="Nenhum registro encontrado." Visible="false"></asp:Label>
        </asp:View>
        <asp:View ID="View2" runat="server">
            <div class="subTitulo">
                <asp:Label ID="lblTituloView2" runat="server" Text="Editar funcionário" />
            </div>
            <br />
            <div id="divMsg2" class="isa_info" runat="server" visible="false" >
                <asp:Label ID="lblMsg2" runat="server" Text="Mensagem." />
            </div>
            <asp:HiddenField ID="IDFuncionario" runat="server" /><br />
            <asp:CheckBox ID="ckbTipoFunc" runat="server" Text="É Gerente?" />
            <br />
            <br />
            <asp:Label ID="lblNome" runat="server" Text="Nome:" />
            <br />
            <asp:TextBox ID="txtNome" runat="server" />
            <asp:RequiredFieldValidator ID="rfvNome" runat="server" ErrorMessage="* Campo Nome não preenchido."
                ForeColor="Red" ControlToValidate="txtNome" Font-Size="X-Small"></asp:RequiredFieldValidator>
            <br />
            <br />

            <asp:Label ID="lblCpf" runat="server" Text="CPF:" />          
            <br />
            <asp:TextBox ID="txtCpf" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator id="rfvCpf" runat="server" ControlToValidate="txtCpf"
                ErrorMessage="* Campo CPF não preenchido." ForeColor="Red" Font-Size="X-Small" />
            <asp:RegularExpressionValidator ID="revCPFCadastro" runat="server" ControlToValidate="txtCpf"
                ErrorMessage="* Campo CPF inválido." ForeColor="Red" Font-Size="X-Small"
                ValidationExpression="(^(\d{3}.\d{3}.\d{3}-\d{2})|(\d{11})$)"></asp:RegularExpressionValidator>
            <asp:MaskedEditExtender ID="txtCPF_MaskedEditExtender" runat="server" AutoComplete="false"
                    ClearMaskOnLostFocus="False" Mask="999\.999\.999\-99" MaskType="Number" TargetControlID="txtCpf">
                </asp:MaskedEditExtender>
            <br />
            <br />
            <asp:Label ID="lblRg" runat="server" Text="RG:" />
            <br />
            <asp:TextBox ID="txtRg" runat="server" />
            <asp:RequiredFieldValidator ID="rfvRg" runat="server" ErrorMessage="* Campo RG não preenchido."
                ForeColor="Red" ControlToValidate="txtRg" Font-Size="X-Small"></asp:RequiredFieldValidator>
            <br />
            <br />
            <asp:Label ID="lblDataNasc" runat="server" Text="Data de Nascimento:" />
            <br />
            <asp:TextBox ID="txtDataNasc" runat="server" Text="Date" />
            <%--<Juice:Datepicker runat="server" ID="dpkDataNasc" TargetControlID="txtDataNasc" DateFormat="dd/mm/yy"/>--%>
            <asp:RequiredFieldValidator ID="rfvDataNasc" runat="server" ErrorMessage="* Campo data não preenchido."
                ForeColor="Red" ControlToValidate="txtDataNasc" Font-Size="X-Small"></asp:RequiredFieldValidator>
            <asp:CompareValidator ID="cvDataNasc" runat="server" ErrorMessage="* Data inválida."
                Type="Date" ControlToValidate="txtDataNasc" ForeColor="Red" Font-Size="X-Small"
                Operator="GreaterThan" ValueToCompare="01/01/1900"></asp:CompareValidator>
            <asp:MaskedEditExtender ID="DataNasc_MaskedEditExtender" runat="server" AutoComplete="false"
                    ClearMaskOnLostFocus="False" Mask="99/99/9999" MaskType="Date" TargetControlID="txtDataNasc">
               </asp:MaskedEditExtender>
            <br />
            <br />
            <asp:Label ID="lblEnd" runat="server" Text="Endereço:" />
            <br />
            <asp:TextBox ID="txtEnd" runat="server" TextMode="MultiLine" />
            <asp:RequiredFieldValidator ID="rfvEnd" ControlToValidate="txtEnd" runat="server"
                ErrorMessage="* Campo Endereço não preenchido." ForeColor="Red" Font-Size="X-Small" />
            <br />
            <br />
            <asp:Label ID="lblTel1" runat="server" Text="Telefone 1:" />
            <br />
            <asp:TextBox ID="txtTel1" runat="server" />
            <asp:MaskedEditExtender ID="tel1_MaskedEditExtender" runat="server" AutoComplete="false"
                    ClearMaskOnLostFocus="False" Mask="(99)9999-9999" MaskType="None" TargetControlID="txtTel1">
               </asp:MaskedEditExtender>
            <br />
            <br />
            <asp:Label ID="lblTel2" runat="server" Text="Telefone 2:" />
            <br />
            <asp:TextBox ID="txtTel2" runat="server" />
             <asp:MaskedEditExtender ID="tel2_MaskedEditExtender" runat="server" AutoComplete="false"
                    ClearMaskOnLostFocus="False" Mask="(99)9999-9999" MaskType="None" TargetControlID="txtTel2">
               </asp:MaskedEditExtender>
            <br />
            <br />
            <asp:Label ID="lblTel3" runat="server" Text="Telefone 3:" />
            <br />
            <asp:TextBox ID="txtTel3" runat="server" />
              <asp:MaskedEditExtender ID="tel3_MaskedEditExtender" runat="server" AutoComplete="false"
                    ClearMaskOnLostFocus="False" Mask="(99)9999-9999" MaskType="None" TargetControlID="txtTel3">
               </asp:MaskedEditExtender>
            <br />
            <br />
            <asp:Label ID="lblUsuario" runat="server" Text="Usuário:" />
            <br />
            <asp:DropDownList ID="ddlUsuario" runat="server">
            </asp:DropDownList>
            <%--<asp:RequiredFieldValidator ID="rfvUsuario" runat="server" ErrorMessage="* Usuário não selecionado"
                ForeColor="Red" ControlToValidate="ddlUsuario" Font-Size="X-Small" Display="Dynamic" InitialValue="0"></asp:RequiredFieldValidator>
            --%>
            <br />
            <br />
            <asp:CheckBox ID="ckbAtivo" runat="server" Text="Ativo" Checked="True" />
            <br />
            <br />
            <center>
            <asp:Button ID="btnSalvar" runat="server" Text="Salvar" OnClick="btnSalvar_Click"
                CssClass="Botao" />
            <asp:Button ID="btnVoltar" runat="server" Text="Voltar" OnClick="btnVoltar_Click"
                CssClass="Botao" CausesValidation="false" />
            </center>
            <br />
        </asp:View>
        <asp:View ID="View3" runat="server">
            <div class="subTitulo" >
                <asp:Label ID="lblTituloView3" runat="server" Text="Associar metas" />
            </div>
            <br />
            <div id="divMsg3" class="isa_info" runat="server" visible="false" >
                <asp:Label ID="lblMsg3" runat="server" Text="Mensagem." />
            </div>
            <asp:HiddenField ID="IDMetaFuncionario" runat="server" /><br />
            <asp:HiddenField ID="IDFuncionario3" runat="server" /><br />
            <asp:Label ID="lblFuncionario" runat="server" Text="Funcionário:" />
            <br />
            <asp:TextBox ID="txtFuncionario" runat="server" ReadOnly="true" />
            <br />
            <br />
            <asp:Label ID="lblMeta" runat="server" Text="Meta:" />
            <br />
            <asp:DropDownList ID="ddlMeta" runat="server" />
            <br />
            <br />
            <asp:Label ID="lblDataInicial" runat="server" Text="Data Inicial:" />
            <br />
            <asp:TextBox ID="txtDataInicial" runat="server" TextMode="DateTime" />
            <Juice:Datepicker runat="server" ID="dtpDataInicial" TargetControlID="txtDataInicial" DateFormat="dd/mm/yy"/>
            <asp:RequiredFieldValidator ID="rfvDataInicial" runat="server" ErrorMessage="* Campo data não preenchido."
                ForeColor="Red" ControlToValidate="txtDataInicial" Font-Size="X-Small"></asp:RequiredFieldValidator>
               <asp:MaskedEditExtender ID="MaskedEditExtenderDataInicial" runat="server" AutoComplete="false"
                    ClearMaskOnLostFocus="False" Mask="99/99/9999 99:99:99" MaskType="DateTime"  TargetControlID="txtDataInicial">
               </asp:MaskedEditExtender>
            <br />
            <br />
            <asp:Label ID="lblDataFinal" runat="server" Text="Data Final:" />            
            <br />
            <asp:TextBox ID="txtDataFinal" runat="server" TextMode="DateTime" />
            <Juice:Datepicker runat="server" ID="dtpDataFinal" TargetControlID="txtDataFinal" DateFormat="dd/mm/yy"/>
            <asp:RequiredFieldValidator ID="rfvDataFinal" runat="server" ErrorMessage="* Campo data não preenchido."
                ForeColor="Red" ControlToValidate="txtDataFinal" Font-Size="X-Small"></asp:RequiredFieldValidator>
               <asp:MaskedEditExtender ID="MaskedEditExtenderDataFinal" runat="server" AutoComplete="false"
                    ClearMaskOnLostFocus="False" Mask="99/99/9999 99:99:99" MaskType="DateTime"  TargetControlID="txtDataFinal">
               </asp:MaskedEditExtender>
            <br />
            <br />
            <asp:Label ID="lblQuantidade" runat="server" Text="Quantidade:" />
            <br />
            <asp:TextBox ID="txtQuantidade" runat="server" />
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="* Campo Quantidade não preenchido."
                ForeColor="Red" ControlToValidate="txtQuantidade" Font-Size="X-Small"></asp:RequiredFieldValidator>
            <center>
            <asp:Button ID="btnSalvarMeta" runat="server" Text="Salvar" OnClick="btnSalvarMeta_Click"
                CssClass="Botao" />
            <asp:Button ID="btnVoltarMeta" runat="server" Text="Voltar" OnClick="btnVoltarMeta_Click"
                CssClass="Botao" CausesValidation="false" />
            </center>
            <br />
             <asp:GridView ID="gvMetas" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                DataKeyNames="IDMetaFuncionario" Width="765px" BackColor="White" BorderColor="#DEDFDE"
                BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Vertical"
                OnRowCommand="gvMetas_RowCommand" OnSelectedIndexChanged="gvMetas_SelectedIndexChanged">
                <AlternatingRowStyle BackColor="White" />
                <Columns>
                    <asp:BoundField HeaderText="Meta" DataField="NomeMeta" ItemStyle-HorizontalAlign="Center" />
                    <asp:BoundField HeaderText="Data Inicial" DataField="DataInicial" ItemStyle-HorizontalAlign="Center" />
                    <asp:BoundField HeaderText="Data Final" DataField="DataFinal" ItemStyle-HorizontalAlign="Center" />
                    <asp:BoundField HeaderText="Quantidade" DataField="Quantidade" ItemStyle-HorizontalAlign="Center" />
                    <asp:ButtonField ButtonType="image" ImageUrl="~/Images/excluir.png" CommandName="Excluir"
                        HeaderText="Excluir" ItemStyle-HorizontalAlign="Center" />
                </Columns>
                <FooterStyle BackColor="#CCCC99" />
                <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
                <RowStyle BackColor="#F7F7DE" />
                <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
                <SortedAscendingCellStyle BackColor="#FBFBF2" />
                <SortedAscendingHeaderStyle BackColor="#848384" />
                <SortedDescendingCellStyle BackColor="#EAEAD3" />
                <SortedDescendingHeaderStyle BackColor="#575357" />
            </asp:GridView>  
            <asp:Label ID="lblMsgGridMetas" runat="server" Text="Nenhum registro encontrado." Visible="false"></asp:Label>
        </asp:View>
    </asp:MultiView>
</asp:Content>
